﻿using System;
using System.Collections.Generic;
using Xenta.Entities;
using Xenta.Enums;

namespace Xenta.Plugins
{
    /// <summary>
    /// Exposes the IPN handler interface.
    /// </summary>
    public interface IIPNHandler : IPlugin
    {
        /// <summary>
        /// Determines the payment global unique identifier.
        /// </summary>
        /// <param name="ipn">The IPN.</param>
        /// <param name="guid">
        /// When this method returns, 
        /// contains the global unique 
        /// identifier.
        /// </param>
        /// <returns>
        /// The null or an empty string, if the IPN was 
        /// identified successfully; otherwise contains an 
        /// error message.
        /// </returns>
        string Identify(IDictionary<String, String> ipn, 
            out Guid guid);

        /// <summary>
        /// Handles the IPN.
        /// </summary>
        /// <param name="ipn">The IPN.</param>
        /// <param name="payment">The payment.</param>
        /// <param name="status">
        /// When this method returns, 
        /// contains the new payment status.
        /// </param>
        /// <returns>
        /// The null or an empty string, if the IPN was 
        /// handled successfully; otherwise contains an 
        /// error message.
        /// </returns>
        string Handle(IDictionary<String, String> ipn, 
            PaymentEntity payment, 
            out PaymentFlags status);
    }
}